]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
autorunManager: Don't scan the filesystem if autorun is disabled
authorJasper St. Pierre <jstpierre@mecheye.net>
Sun, 16 Sep 2012 17:24:25 +0000 (14:24 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 3 Oct 2012 17:34:52 +0000 (14:34 -0300)
Content-Type scanning can be expensive, and the user disabled autorun, so...

https://bugzilla.gnome.org/show_bug.cgi?id=684093

js/ui/components/autorunManager.js

index 942576ad374ec6bd6cf96a07458da89a9aaacb32..495063e38649e9e69473e90ea3911b847274da16 100644 (file)
@@ -83,13 +83,20 @@ const ContentTypeDiscoverer = new Lang.Class({
 
     _init: function(callback) {
         this._callback = callback;
+        this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
     },
 
     guessContentTypes: function(mount) {
-        // guess mount's content types using GIO
-        mount.guess_content_type(false, null,
-                                 Lang.bind(this,
-                                           this._onContentTypeGuessed));
+        let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
+
+        if (autorunEnabled) {
+            // guess mount's content types using GIO
+            mount.guess_content_type(false, null,
+                                     Lang.bind(this,
+                                               this._onContentTypeGuessed));
+        } else {
+            this._emitCallback(mount, []);
+        }
     },
 
     _onContentTypeGuessed: function(mount, res) {